#include "stdafx.h"
#include "UOpenFileDialog.h"
#include "ULeafWindow.h"

TOpenFileDialog::TOpenFileDialog()
: TControlContainerWindow()
{
	EditPath = new TEdit(TRectangle(30, 10, 300, 30));
	EditPath->textcolor = TVector(0,0,0);
	OkButton = new TTextButton("OK", TGLFontRef() ,TRectangle(0,0,0,0));
	CancelButton = new TTextButton("Cancel", TGLFontRef() ,TRectangle(0,0,0,0));
	DisplayPanel = new TPanel(TRectangle(0,0,0,0));
	DisplayPanel->AddItem(new TTextButton("Test", TGLFontRef(), TRectangle(10,10,70,40)));

	Controls.AddControl(DisplayPanel);
	Controls.AddControl(DisplayPanel->GetItem(0));
	Controls.AddControl(OkButton);
	Controls.AddControl(EditPath);
	Controls.AddControl(CancelButton);

}

void TOpenFileDialog::resize(int w, int h)
{
	TControlContainerWindow::resize(w,h);
	OkButton->setPos(TRectangle(20, Parent->Height() - 50, 80, Parent->Height() - 20));
	CancelButton->setPos(TRectangle(100, Parent->Height() - 50, 160, Parent->Height() - 20));
	DisplayPanel->setPos(TRectangle(40,30,Parent->Width() - 30,Parent->Height() - 70));
}

void TOpenFileDialog::Draw()
{
	TControlContainerWindow::Draw();
}
